package com.wzz.utils.kms;

/**
 * @author liutao
 * @title: Point
 * @projectName manage
 * @description: TODO
 * @date 2024年04月10日 18:44
 */
public  class Point {
    private double x;
    private double y;
    private int cluster;

    public Point(double x, double y) {
        this.x = x;
        this.y = y;
        this.cluster = -1; // 初始化为无簇
    }

    public Point(double x, double y,int cluster) {
        this.x = x;
        this.y = y;
        this.cluster = cluster; // 初始化为无簇
    }

    public double getX() {
        return x;
    }

    public double getY() {
        return y;
    }

    public int getCluster() {
        return cluster;
    }

    public void setCluster(int cluster) {
        this.cluster = cluster;
    }

    public double distanceTo(Point other) {
        double dx = this.x - other.x;
        double dy = this.y - other.y;
        return Math.sqrt(dx * dx + dy * dy);
    }

    @Override
    public String toString() {
        return "(" + x + ", " + y + ")";
    }
}
